/**
 * Created by Administrator on 2017/7/19.
 */
$(function () {
    //ajaxboxam();
    /*border_move();*/
})
function ajaxboxam() {
    $.ajax({
        url: 'announcement/getbox32list.do',
        dataType: "json", // 返回格式为json
        type: "POST", // 请求方式
        success: function (req) {
            if(req.obj[0]==undefined){
                $(".b32-header").text("暂无通知");
                $(".myBlock .limarquee div").html("");
            }else{
                $(".b32-header").text(req.obj[0].columnTitle);
                var html = "<br/>";
                html+=req.obj[0].content+"<br/>";
                $(".myBlock .limarquee div").html(html);
                /*$(".myBlock").css({height:229/1080*h+"px",paddingTop:4/108*h+"px",paddingLeft:4/192*w+"px",paddingbottom:39/1080*w+"px"});*/
                /*$(".b32-content ul li span").css({height: 24 / 1080 * h + "px", 'line-height': 24 / 1080 * h + "px"});*/
                if($('.limarquee div').height()>$(".limarquee").height()){
                    $('.limarquee').liMarquee({
                        direction: 'up',
                        scrollamount:20,
                    });
                }
            }
        }
    });
};
/**
 * 边框旋转
 */
function border_move() {
    var borTop = document.getElementById("J_borTop"),
        borBottom = document.getElementById("J_borBottom"),
        borLeft = document.getElementById("J_borLeft"),
        borRight = document.getElementById("J_borRight"),
        left = getStyleValue(borTop, 'left'),
        top = getStyleValue(borLeft, 'top');

    setInterval(function () {
        if (left < 0) {
            left += 2;
            borRight.style.top = left + "px";
            borTop.style.left = left + "px";
        } else left = -1500;

        if (top > -3000) {
            top -= 2;
            borBottom.style.left = top + "px";
            borLeft.style.top = top + "px";
        } else top = -1500;
    }, 60);
}
function getStyleValue(ele,attr){
    var doc=document;
    var style=ele.currentStyle||doc.defaultView.getComputedStyle(ele,null);
    return parseInt(style[attr].replace(/px/g,""));
}
/*function ajaxboxam() {
 $.ajax({
 url: 'announcement/getAMToView.do',
 dataType: "json", // 返回格式为json
 type: "POST", // 请求方式
 success: function (req) {
 var html = "";
 for (var i = 0; i < req.obj.length; i++) {
 html += "<li> " +
 "<span>" + req.obj[i].vday + "</span> " +
 "<span>" + req.obj[i].vhour + "</span> " +
 "<span>" + req.obj[i].columnTitle + "</span> " +
 "</li>"
 }
 $(".myBlock ul").html(html);
 $(".myBlock").css({
 height: 21 / 108 * h + "px",
 paddingTop: 4 / 108 * h + "px",
 paddingLeft: 4 / 192 * w + "px",
 paddingbottom: 2 / 192 * w + "px"
 });
 $(".b32-content ul li span").css({height: 48 / 1080 * h + "px", 'line-height': 48 / 1080 * h + "px"});
 $(".myBlock").myScroll({
 speed: 40,
 rowHeight: 48 / 1080 * h
 });
 }
 });
 }*/